/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;


import org.springframework.orm.jpa.support.JpaDaoSupport;

/**
 *
 * @author odeen
 */

public class ProyectoJPADAOImpl extends JpaDaoSupport implements ProyectoDAO2 {

    @Override
    public void guardarAutor(Autor autor) {
        autor = this.getJpaTemplate().merge(autor);
        this.getJpaTemplate().persist(autor);
        this.getJpaTemplate().flush();
    }

    @Override
    public void actualizarAutor(Autor autor) {
        Autor a = this.getJpaTemplate().merge(autor);
        this.getJpaTemplate().persist(a);
        this.getJpaTemplate().flush();
    }

    @Override
    public void borrarAutor(Autor autor) {
        Autor a = this.getJpaTemplate().merge(autor);
        this.getJpaTemplate().remove(a);
        this.getJpaTemplate().flush();
    }

    @Override
    public Autor buscarAutorPorId(int id) {
        return (Autor) this.getJpaTemplate().find(Autor.class, id);
    }
}
